<include file="public:header" />
<div class="subnav">
<h1 class="title_2 line_x">本接口用于刷新商品的优惠券数量，销量以及检测商品是否过期、是否无券 </h1>
</div>
<div class="pad_lr_10">
    <form id="J_info_form" action="{:U('Refresh/setting')}" method="post">
    <table width="100%" cellspacing="0" class="table_form">
        <tr>
            <th width="100">刷新无券商品 :</th>
            <td>
                <label class="mr10"><input name="refresh_type" type="radio" class="J_change_status" value="1" > {:L('open')}</label>
                <label><input name="refresh_type" type="radio" class="J_change_status" checked="checked" value="0" > {:L('close')}</label>
                <span class="gray ml10">针对阿里妈妈采集器的商品是否需要刷新销量;根据服务器配置而定,不建议开始</span>
            </td>
        </tr>	
        <tr>
            <th width="150">选择商品分类 :</th>
            <td>
			<select class="J_cate_select mr10" data-pid="0" data-uri="{:U('items_cate/ajax_getchilds', array('type'=>0))}"></select>
			 <input type="hidden" name="cate_id" id="J_cate_id" />
			 <span class="red">可以不选</span>
			</td>
        </tr>	
<!--		<tr>
	          <th>每次刷新个数 :</th>
	          <td>
			  <input type="text" name="precount" size="8" class="input-text" value="50"/>
			  </td>
	    </tr> 	-->	
		<tr>
          <th>商品ID起始范围 :</th>
          <td>
		  <input type="text" name="fid" size="10" class="input-text" value="0"/> - 
          <input type="text" name="eid" size="10" class="input-text" value="0"/>
		  <span class="red">商品站内ID，即商品管理列表中商品图片前面的数字ID，如刷新全部申请请都输入0 </span>
		  </td>
          </tr>
        <tr>
            <th></th>
            <td><input type="submit" value="开始更新" name="dosubmit" class="smt mr10"></td>
        </tr>
    </table>
   
    </form>	
</div>
<include file="public:footer" />
<script>
$('.J_cate_select').cate_select('请选择');
$(function(){
    var collect_url = "{:U('Refresh/collect')}";
    $('#J_info_form').ajaxForm({success:complete, dataType:'json'});
    var p = 2;
    function complete(result){
        if(result.status == 1){
            $.dialog({id:'direct', title:result.msg, content:result.data, padding:'', lock:true});
            p = 2;
            collect_page();
        } else {
            $.itaoke.tip({content:result.msg, icon:'alert'});
        }
    }
    function collect_page(){
        $.getJSON(collect_url, {p:p}, function(result){
            if(result.status == 1){
                $.dialog.get('direct').content(result.data);
                p++;
                collect_page(p);
            }else{
                $.dialog.get('direct').close();
                $.itaoke.tip({content:result.msg});
            }
        });
    }
});
</script>
</body>
</html>